#include <QtGui>
#include "gv_base.h"

GV_Base::GV_Base(QWidget *parent)
{
    setFixedSize(QSize(360,240));
    timer = new QTimer;
    datetime=new QDateTime;

    labelTime = new QLabel;
    labelTime->setGeometry( QRect(10,10,50,10));
    labelTime->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));

    labelHints = new QLabel;
    labelHints->setText("Base Setup");

    labelDate = new QLabel;
    labelDate->setGeometry( QRect(190,10,50,10));
    labelDate->setText((QDateTime::currentDateTime().toString("yyyy-mm-dd")));

    hboxLayout=new QHBoxLayout;
    hboxLayout->addWidget(labelTime);
    hboxLayout->addWidget(labelHints);
    hboxLayout->addWidget(labelDate);
    hboxLayout->setGeometry(QRect(0,0,360,20));
    hboxLayout->setAlignment(Qt::AlignTop);

}
void GV_Base::setupui()
{
    setLayout(hboxLayout);
}

void GV_Base::start()
{

    connect(timer,SIGNAL(timeout()),this,SLOT(gv_chTime()));
    timer->start(1000);
}
void GV_Base::gv_chTime()
{
    labelTime->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    labelDate->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
}
GV_Base::~GV_Base()
{

}
